<script setup lang='ts'>
  import { onMounted, reactive } from 'vue';
  import { systemApi } from '@/api/controller';
  import { Toastloading } from '@/utils/public';
  import Pagination from "@/components/Pagination/index.vue";
  const action = reactive({
    total:0,
    list:[] as any[],
  })
  const listQuery = reactive({
    page:1,
    limit:20,
  })
  const handleSerach = ()=>{
    listQuery.page = 1
    getList()
  }
  const getList = async()=> {
    const loading = Toastloading()
    const res = await systemApi.getAdminLogList(listQuery)
    loading.close()
    const { data=[], total=0 } = res.data
    action.total = total
    action.list = data
  }
  onMounted(()=>{
    getList()
  })
</script>

<template>
  <div class="xm-content">
    <div class="xm-headTab">
      <div class="labelBox">
        <div class="labelItem">
          <el-button type="primary" @click="handleSerach">刷新</el-button>
        </div>
      </div>
    </div>
    <el-table
      class="xm-main xm-TableCenter"
      :data="action.list"
      border
    >
      <el-table-column width="90" prop="id" label="ID" />
      <el-table-column width="160" prop="admin_name" label="管理员" />
      <el-table-column width="180" prop="path" label="PATH" />
      <el-table-column width="120" prop="method" label="METHOD" />
      <el-table-column width="160" prop="ip" label="IP" />
      <el-table-column show-overflow-tooltip min-width="160" prop="input" label="INPUT" />
      <el-table-column width="180" prop="created_at" label="创建时间" />
    </el-table>
    <Pagination v-show="action.total > 0" :total="action.total" v-model:page="listQuery.page"
      v-model:limit="listQuery.limit" @pagination="getList" />
  </div>
</template>